<script src="../../vendor/echarts/theme/macarons.js"></script>

<!-- 数据存储页面正文 -->
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">数据存储</h1>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-primary">
                <div class="panel-heading fontSize24">
                    <i class="fa fa-bar-chart-o fa-fw"></i> 数据存储管理
                </div>

                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="dataStoreSpace-pieBody">
                                <div id="dataStoreSpace-pieChart" style="width:100%;max-width:1540px;height:500px"></div>
                            </div>
                        </div>
                    </div>

                    <div class="row catalogConfigBox">
                        <div class="col-lg-12">
                            <div class="panel panel-default">
                                <div class="panel-heading fontSize20">
                                    <span class="selectCatalogName">所选目录</span>的存储空间配额信息列表
                                </div>

                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-striped table-bordered">
                                            <thead>
                                            <tr>
                                                <th>序号</th>
                                                <th>目录名称</th>
                                                <th>类型</th>
                                                <th>共享目录标识</th>
                                                <th>目录路径</th>
                                                <th>是否检测</th>
                                                <th>最大可占空间</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr class="success">
                                                <td>1</td>
                                                <td class="selectCatalogName">Mark</td>
                                                <td>Otto</td>
                                                <td>@mdo</td>
                                                <td>Mark</td>
                                                <td>Otto</td>
                                                <td>@mdo</td>
                                            </tr>
                                            <tr class="info">
                                                <td>2</td>
                                                <td class="selectCatalogName">Jacob</td>
                                                <td>Thornton</td>
                                                <td>@fat</td>
                                                <td>Jacob</td>
                                                <td>Thornton</td>
                                                <td>@fat</td>
                                            </tr>
                                            <tr class="warning">
                                                <td>3</td>
                                                <td class="selectCatalogName">Larry</td>
                                                <td>the Bird</td>
                                                <td>@twitter</td>
                                                <td>Larry</td>
                                                <td>the Bird</td>
                                                <td>@twitter</td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <div class="row catalogConfigBox">
                        <div class="col-lg-12">
                            <div class="panel panel-default">
                                <div class="panel-heading fontSize20">
                                    数据存储目录配额配置
                                </div>

                                <div class="panel-body">
                                    <form class="form-horizontal fontSize16" id="catalogConfigForm">
                                        <div class="control-group form-group text-center fontSize18">
                                            <label class="control-label">配置目录名称：</label>
                                            <span class="form-control-static" id="inputCatalogName">所选目录名</span>
                                        </div>

                                        <div class="control-group form-group">
                                                <div class="col-lg-4 col-lg-offset-2 controls">
                                                    <label class="control-label" for="inputSharedIdentity">共享目录标识：</label>
                                                    <input type="text" id="inputSharedIdentity" placeholder="共享目录标识" autofocus="autofocus" required="required">
                                                </div>

                                                <div class="col-lg-5 col-lg-offset-1 controls">
                                                    <label class="control-label" for="inputCatalogType">类型：</label>
                                                    <select class="form-control fontSize16" id="inputCatalogType">
                                                        <option value="" selected disabled>--请选择--</option>
                                                        <option value="1">1</option>
                                                        <option value="2">2</option>
                                                        <option value="3">3</option>
                                                        <option value="4">4</option>
                                                        <option value="5">5</option>
                                                    </select>
                                                </div>
                                        </div>

                                        <div class="control-group form-group">
                                                <div class="col-lg-4 col-lg-offset-2 controls">
                                                    <label class="control-label" for="inputLargestSpace">最大可占空间：</label>
                                                    <input type="number" id="inputLargestSpace" placeholder="最大可占空间" required="required">
                                                </div>

                                                <div class="col-lg-5 col-lg-offset-1 controls">
                                                    <label class="control-label">是否检测：</label>
                                                    <label class="radio-inline clearPaddingTop">
                                                        <input type="radio" name="optionsRadiosInline" id="inputIsCheck" value="option1" checked="checked">检测
                                                    </label>
                                                    <label class="radio-inline clearPaddingTop">
                                                        <input type="radio" name="optionsRadiosInline" id="inputNoCheck" value="option2">不检测
                                                    </label>
                                                </div>
                                        </div>

                                        <div class="control-group form-group">
                                            <div class="col-lg-12 controls text-right">
                                                <button type="reset" class="btn btn-default fontSize16">重置配置</button>
                                                <button type="submit" class="btn btn-primary fontSize16" data-href="dataManage/DataStore.html" data-state="success">完成配置</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="panel-footer">
                    点击圆环中的某个目录即可对该目录的存储空间配额进行配置
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    (function () {

        var $CatalogConfigBox = $('.catalogConfigBox');
        $CatalogConfigBox.hide();

        /* HDFS中各目录所占空间对比饼状图 */
        var dataStoreSpaceChart = new MyEcharts({
            DOMId: 'dataStoreSpace-pieChart',
            option: {
                titleText: 'HDFS中各目录所占空间的对比图',
                legendDataList: ['目录1','目录2','目录3','目录4','目录5'],
                isPie: true,
                pieAxisDataKey: 'category',
                series: [
                    {
                        name: '占用空间（GB）',
                        type: 'pie',
                        dataKey: 'val'
                    }
                ],
                tooltipTrigger: 'item',
                tooltipFormatter: "{a} <br/>{b} : {c} ({d}%)",
                calculable: true
            },
            dataUrl: '../../server/dataStoreSpaceData.json',
            theme: 'macarons'
        });

        dataStoreSpaceChart._addEvent('click', function (param) {
            $('#inputCatalogName').text(param.name);
            $('.selectCatalogName').text(param.name);
            $CatalogConfigBox.slideDown();
        });

    })();
</script>

